using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace Kotonoha.Server.Dictionaries {
    public class WordEntry {
        private IList<string> readings = new List<string>();
        private IList<string> writings = new List<string>();
        private IList<Meaning> meanings = new List<Meaning>();

        public virtual long Id { get; set; }

        public virtual IList<string> Readings {
            [DebuggerStepThrough]
            get { return readings; }
            [DebuggerStepThrough]
            set { readings = value; }
        }

        public virtual IList<string> Writings {
            [DebuggerStepThrough]
            get { return writings; }
            [DebuggerStepThrough]
            set { writings = value; }
        }

        public virtual IList<Meaning> Meanings {
            [DebuggerStepThrough]
            get { return meanings; }
            [DebuggerStepThrough]
            set { meanings = value; }
        }

        public override string ToString() {
            return string.Format("{0} ({1})", Writings.Aggregate(joinString), Readings.Aggregate(joinString));
        }

        private static string joinString(string s1, string s2) {
            return string.Format("{0}, {1}", s1, s2);
        }
    }
}